// 先引入经过自定义全局封装的 axios
import request from "/@/utils/request";

// 配置项
export function configData(params:any) {
  return request({
    url: "/oauth/base/dict/list",
    method: "GET",
    // params:params,
		data: params,
  });
}

/**
 * 运费模板列表
 * api?page=1&limit=999
 */
export function freightTemplateList(params:any) {
  const paramsQuery = Object.assign({}, params, {  
		page: params.pageNum,
		size: params.pageSize,
	});  
  delete paramsQuery.pageNum;
	delete paramsQuery.pageSize
	return request({
		url: '/admin/express/shipping/templates/list',
		method: 'GET',
    // params:paramsQuery,
		// data: {},
	});
}

/**
 * 运费模板详情
 */
export function freightTemplateInfo(params:any) {
	return request({
		url: '/admin/express/shipping/region/list',
		method: 'GET',
		params: params,
	});
}

/**
 *  运费模板新增
 */
export function freightTemplateSave(params:any) {
	return request({
		url: '/admin/express/shipping/templates/save',
    method: 'POST',
    // params:paramsQuery,
		data: params,
	});
}


/**
 *  运费模板编辑
 */
export function freightTemplateUpdate(params:any) {
	return request({
		url: 'api/admin/express/shipping/templates/update',
    method: 'POST',
    // params:paramsQuery,
		data: params,
	});
}

// 会员等级列表
export function tencentClouddemandSign() {
  return request({
    url: "/upload/get/tencent/clouddemand/sign",
    method: "GET",
    // data: params,
  });
}


 /**
* 门店列表
* @param params 要传的查询参数值
* @returns 返回接口数据
*  null 全部 0直营 1加盟
*/
export function storeList(params: Object) {
  return request({
    url: "/store/node/list",
    method: "POST",
    data: params,
  });
}


// 会员等级列表
export function membershipList(params: any) {
  return request({
    url: "/admin/system/user/level/list",
    method: "GET",
    data: params,
  });
}

// 付费会员等级列表
export function paymembershipList() {
  return request({
    url: "/goodstype/paidMemberType",
    method: "GET",
  });
}

// 限购项
export function restrictBuyTypeList() {
  return request({
    url: "/goodstype/restrictBuyType",
    method: "GET",
		// data: {},
    // data: params,
  });
}

// 商品类型获取
export function chainList() {
	return request({
		url: '/goodstype/getChain',
		method: 'GET',
	});
}

// 分销商等级
export function distributionCommissionTypeList() {
	return request({
		url: '/goodstype/distributionCommissionType',
		method: 'GET',
	});
}


/**
 *  获取上传阿里存储 相关数据 
 */
export function ossConfig() {
  return request({
    url: "/applet/admin/file/oss/config",
    method: "GET",
		// data: params,
  });
}



// 文章列表
export function articleList(params:any) {
  const paramsQuery = Object.assign({}, params, {  
    current: params.pageNum,
    size: params.pageSize,
  });
  delete paramsQuery.pageNum;
  delete paramsQuery.pageSize;
  return request({
    url: "/product/promise/list",
    method: "POST",
    // params:params,
		data: params,
  });
}

// 文章详情
export function articleDetails(params:any) {
  return request({
    url: "/product/promise/list",
    method: "POST",
		data: params,
  });
}


// 文章新增
export function articleAdd(params:object) {
  return request({
    url: "/product/promise/upsert",
    method: "POST",
    // params:params,
		data: params,
  });
}

// 文章删除
export function articleDelete(id: Number) {
	return request({
		url: `/product/promise/remove/${id}`,
		method: 'DELETE',
	});
}


// 用户列表查询
export function tuserSeacrh(params:object) {
  return request({
    url: "/oauth/tuser/search",
    method: "POST",
		data: params,
  });
}

